<?php
/*******************************************************************************
*  Title: Help Desk Software HESK
*  Version: 2.2 from 9th June 2010
*  Author: Klemen Stirn
*  Website: http://www.hesk.com
********************************************************************************
*  COPYRIGHT AND TRADEMARK NOTICE
*  Copyright 2005-2010 Klemen Stirn. All Rights Reserved.
*  HESK is a registered trademark of Klemen Stirn.

*  The HESK may be used and modified free of charge by anyone
*  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
*  By using this code you agree to indemnify Klemen Stirn from any
*  liability that might arise from it's use.

*  Selling the code for this program, in part or full, without prior
*  written consent is expressly forbidden.

*  Using this code, in part or full, to create derivate work,
*  new scripts or products is expressly forbidden. Obtain permission
*  before redistributing this software over the Internet or in
*  any other medium. In all cases copyright and header must remain intact.
*  This Copyright is in full effect in any country that has International
*  Trade Agreements with the United States of America or
*  with the European Union.

*  Removing any of the copyright notices without purchasing a license
*  is expressly forbidden. To remove HESK copyright notice you must purchase
*  a license for this script. For more information on how to obtain
*  a license please visit the page below:
*  https://www.hesk.com/buy.php
*******************************************************************************/

define('IN_SCRIPT',1);
define('HESK_PATH','../');

/* Make sure the install folder is deleted */
if (is_dir(HESK_PATH . 'install')) {die('Please delete the <b>install</b> folder from your server for security reasons then refresh this page!');}

/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/database.inc.php');

hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();

define('CALENDAR',1);
define('MAIN_PAGE',1);

/* Print header */
require_once(HESK_PATH . 'inc/header.admin.inc.php');

/* Print admin navigation */
require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
?>

</td>
</tr>

<?php if($_SESSION['isadmin']) : ?>
<tr>
    <td height="10px"></td>
</tr>
<tr>
    <td>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
            <tr>
                <td width="33%">
                    <!-- START SUBMIT -->
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="7" height="7"><img src="../img/roundcornerslt.jpg" width="7" height="7" alt="" /></td>
                            <td class="roundcornerstop"></td>
                            <td><img src="../img/roundcornersrt.jpg" width="7" height="7" alt="" /></td>
                        </tr>
                        <tr>
                            <td class="roundcornersleft">&nbsp;</td>
                            <td>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="1"><img src="../img/download.png" alt="" width="60" height="60" /></td>
                                        <td>
                                            <p><b><a href="pe.php"><?php echo $hesklang['manage_trial']; ?></a></b><br />
                                                <?php echo $hesklang['trial_def']; ?></p>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td class="roundcornersright">&nbsp;</td>
                        </tr>
                        <tr>
                            <td><img src="../img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
                            <td class="roundcornersbottom"></td>
                            <td width="7" height="7"><img src="../img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
                        </tr>
                    </table>
                    <!-- END SUBMIT -->
                </td>
                <td width="1"><img src="../img/blank.gif" width="5" height="1" alt="" /></td>
                <td width="33%">
                    <!-- START VIEW -->
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="7" height="7"><img src="../img/roundcornerslt.jpg" width="7" height="7" alt="" /></td>
                            <td class="roundcornerstop"></td>
                            <td><img src="../img/roundcornersrt.jpg" width="7" height="7" alt="" /></td>
                        </tr>
                        <tr>
                            <td class="roundcornersleft">&nbsp;</td>
                            <td>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="1"><img src="../img/ads-ico.gif" alt="" width="60" height="60" /></td>
                                        <td>
                                            <p><b><a href="ae.php"><?php echo $hesklang['manage_ads']; ?></a></b><br />
                                                <?php echo $hesklang['ads_def']; ?></p>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td class="roundcornersright">&nbsp;</td>
                        </tr>
                        <tr>
                            <td><img src="../img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
                            <td class="roundcornersbottom"></td>
                            <td width="7" height="7"><img src="../img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
                        </tr>
                    </table>
                    <!-- END VIEW -->
                </td>
                <td width="1"><img src="../img/blank.gif" width="5" height="1" alt="" /></td>
                <td width="33%">
                    <!-- START DIAGNOSE -->
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="7" height="7"><img src="../img/roundcornerslt.jpg" width="7" height="7" alt="" /></td>
                            <td class="roundcornerstop"></td>
                            <td><img src="../img/roundcornersrt.jpg" width="7" height="7" alt="" /></td>
                        </tr>
                        <tr>
                            <td class="roundcornersleft">&nbsp;</td>
                            <td>
                                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td width="1"><img src="../img/dokter.png" alt="" width="60" height="60" /></td>
                                        <td>
                                            <p><b><a href="te.php"><?php echo $hesklang['manage_diagnose']; ?></a></b><br />
                                            <?php echo $hesklang['diagnose_def']; ?></p>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td class="roundcornersright">&nbsp;</td>
                        </tr>
                        <tr>
                            <td><img src="../img/roundcornerslb.jpg" width="7" height="7" alt="" /></td>
                            <td class="roundcornersbottom"></td>
                            <td width="7" height="7"><img src="../img/roundcornersrb.jpg" width="7" height="7" alt="" /></td>
                        </tr>
                    </table>
                    <!-- END DIAGNOSE -->
                </td>
            </tr>
        </table>
        
    </td>
</tr>
<?php else: ?>
<tr>
    <td>
        <?php
                require_once(HESK_PATH . 'inc/database.inc.php');

                hesk_dbConnect();

                $sql = 'SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'promo`';
                $result = hesk_dbQuery($sql);

                $row = hesk_dbFetchAssoc($result);

                $product_id_1 = $row['id'];
                $product_name_1 = $row['name'];
                $product_desc_1 = $row['description'];
                $product_link_1 = $row['link'];

                $row = hesk_dbFetchAssoc($result);

                $product_id_2 = $row['id'];
                $product_name_2 = $row['name'];
                $product_desc_2 = $row['description'];
                $product_link_2 = $row['link'];
                ?>
                <table border="0" width="100%" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="50%">
                            <!-- START SUBMIT -->
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td width="1"><img src="../img/download.png" alt=""/></td>
                                                <td>
                                                    <p><b><a href="<?php echo HESK_PATH;?>trial_download.php?id_product=<?php echo $product_id_1; ?>">Download <?php echo $product_name_1; ?></a></b><br />
                                                        <?php echo $product_desc_1; ?></p>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <!-- END SUBMIT -->
                        </td>
                        <td width="1"><img src="../img/blank.gif" width="5" height="1" alt="" /></td>
                        <td width="50%">
                            <!-- START VIEW -->
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td>
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td width="1"><img src="../img/download.png" alt="" /></td>
                                                <td>
                                                    <p><b><a href="<?php echo HESK_PATH;?>trial_download.php?id_product=<?php echo $product_id_2; ?>">Download <?php echo $product_name_2; ?></a></b><br />
                                                        <?php echo $product_desc_2; ?></p>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <!-- END VIEW -->
                        </td>
                    </tr>
                </table>
    </td>
</tr>
<?php endif; ?>
<tr>
    <td height="10px"></td>
</tr>
<tr>
<td>

<?php

/* This will handle error, success and notice messages */
hesk_handle_messages();

/* Print tickets? */
if (hesk_checkPermission('can_view_tickets',0))
{
	if (!isset($_SESSION['hide']['ticket_list']))
    {
		#echo '<div style="float:center;border:solid black 1px;text-align:center"><h3>'.$hesklang['open_tickets'].'<br />&nbsp;</h3><div style="float:right;border:solid black 1px"><a href="">+ New ticket</a></div></div>';
        echo '
        <table style="width:100%;border:none;border-collapse:collapse;"><tr>
        <td style="width:25%">&nbsp;</td>
        <td style="width:50%;text-align:center"><h3>'.$hesklang['open_tickets'].'</h3></td>
        <td style="width:25%;text-align:right"><a href="new_ticket.php">'.$hesklang['nti'].'</a></td>
        </tr></table>
        ';
	}
	require(HESK_PATH . 'inc/print_tickets.inc.php');
	echo '<hr />';
	require(HESK_PATH . 'inc/show_search_form.inc.php');
}
else
{
	echo '<p><i>'.$hesklang['na_view_tickets'].'</i></p>';
}

?>

<?php

/* Clean unneeded session variables */
hesk_cleanSessionVars('hide');

require_once(HESK_PATH . 'inc/footer.inc.php');
exit();
?>
